@extends('admin.layout')
@section('content')
<style>
    .search_input{
        float: left;
        width: 20%;
    }
    .search_input input{
        width: 70%;
        height: 34px;
        padding: 6px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        background-color: #fff;
        background-image: none;
        border: 1px solid #ccc;
        border-radius: 4px;
    }
</style>
<div class="panel panel-default">
    <div id="notice">
    </div>
    <div class="panel-heading" style="height: auto;">
        <ol class="breadcrumb">
            <li>管理员</li>
            <li class="active">用户列表</li>
        </ol>
    </div>
    <div class="panel-body">
        <div class="table-responsive">
            <table class="table table-hover">
                <caption>
                    <form role="form-control" action="/admin/user">
                        <span class="search_input">用户名: <input type="text" name="username" value="{{$request->username}}"></span>
                        <span class="search_input">邮箱: <input type="text" name="email" value="{{$request->email}}" ></span>
                        <span class="search_input">手机号: <input type="text" name="phone" value="{{$request->phone}}" ></span>
                        <span class="search_input">
                            每页条数:
                            <select name="num" id="">
                                <option value="10" @if($request->num == 10) selected @endif >10</option>
                                <option value="20" @if($request->num == 20) selected @endif >20</option>
                                <option value="30" @if($request->num == 30) selected @endif >30</option>
                                <option value="50" @if($request->num == 50) selected @endif >50</option>
                            </select>
                        </span>
                        <span class="search_input"><button class="btn btn-sm btn-primary">搜索</button></span>
                    </form>
                </caption>
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>用户名</th>
                        <th>邮箱</th>
                        <th>电话</th>
                        <th>账户状态</th>
                        <th>用户权限</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <style>
                	#pages ul{
						margin: 0px;
                	}
                </style>
                <tbody id="userListContent">
                    @foreach($users as $k=>$v)
                    <tr>
                        <td>{{$v['id']}}</td>
                        <td>{{$v['username']}}</td>
                        <td>{{$v['email']}}</td>
		                <td>{{$v['phone']}}</td>
                        <td>@if($v['status']) 正常 @else 禁用 @endif</td>
                        <td>@if($v['auth']) 管理员 @else 普通用户 @endif</td>
                        <td>
                        	<a href="/admin/user/{{$v['id']}}/edit" class="btn btn-info btn-xs col-md-6">编辑</a>
                            <form action="/admin/user/{{$v['id']}}" method="post">
                                <input type="hidden" name="id" value="{{$v['id']}}">
                                <input type="hidden" name="_method" value="delete">
                                {{csrf_field()}}
                                <button class="btn btn-danger btn-xs col-md-6 userDelete">删除</button>
                            </form>
                        </td>
                    </tr>
                    @endforeach
                </tbody>
                    <tr>
                   	    <td colspan="7" id="pages" class="text-right">{!! $users->appends($request->all())->render() !!}</td>
                    </tr>
            </table>
        </div>
    </div>
</div>
@endsection